﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using Maticsoft.DBUtility;//Please add references
namespace Lawyer.DAL
{
	/// <summary>
	/// 数据访问类:ArchiveBaseInfo
	/// </summary>
	public partial class ArchiveBaseInfo
	{
		public ArchiveBaseInfo()
		{}
		#region  Method

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(string ArchiveID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from ArchiveBaseInfo");
			strSql.Append(" where ArchiveID=@ArchiveID ");
			SqlParameter[] parameters = {
					new SqlParameter("@ArchiveID", SqlDbType.VarChar,36)};
			parameters[0].Value = ArchiveID;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
		public bool Add(Lawyer.Model.ArchiveBaseInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into ArchiveBaseInfo(");
			strSql.Append("ArchiveID,FullName,Birthday,Telphone,Fax,Address,CFullName,CBirthday,CTelphone,CFax,CEmail,CRelation,BankFunds,BankAccount,CaseSource,PersonalDetail,PersonalNote,FatherName,FatherDOB,FatherNationality,FatherContact,MotherName,MotherDOB,MotherNationality,MotherContact,SisterName,SisterDOB,SisterContact,SisterNationality,BrotherName,BrotherDOB,BrotherNationality,BrotherContact,AgreedFees,FeesClusive,FeesFundable,PersonalStatement,LawyerNote,AssetAName,AssetAWorth,AssetANote,AssetADetail,AssetBName,AssetBWorth,AssetBNote,AssetBDetail,AssetCName,AssetCWorth,AssetCNote,AssetCDetail,UpdatedBy,UpdatedDate)");
			strSql.Append(" values (");
			strSql.Append("@ArchiveID,@FullName,@Birthday,@Telphone,@Fax,@Address,@CFullName,@CBirthday,@CTelphone,@CFax,@CEmail,@CRelation,@BankFunds,@BankAccount,@CaseSource,@PersonalDetail,@PersonalNote,@FatherName,@FatherDOB,@FatherNationality,@FatherContact,@MotherName,@MotherDOB,@MotherNationality,@MotherContact,@SisterName,@SisterDOB,@SisterContact,@SisterNationality,@BrotherName,@BrotherDOB,@BrotherNationality,@BrotherContact,@AgreedFees,@FeesClusive,@FeesFundable,@PersonalStatement,@LawyerNote,@AssetAName,@AssetAWorth,@AssetANote,@AssetADetail,@AssetBName,@AssetBWorth,@AssetBNote,@AssetBDetail,@AssetCName,@AssetCWorth,@AssetCNote,@AssetCDetail,@UpdatedBy,@UpdatedDate)");
			SqlParameter[] parameters = {
					new SqlParameter("@ArchiveID", SqlDbType.VarChar,36),
					new SqlParameter("@FullName", SqlDbType.VarChar,50),
					new SqlParameter("@Birthday", SqlDbType.DateTime),
					new SqlParameter("@Telphone", SqlDbType.VarChar,20),
					new SqlParameter("@Fax", SqlDbType.VarChar,20),
					new SqlParameter("@Address", SqlDbType.VarChar,255),
					new SqlParameter("@CFullName", SqlDbType.VarChar,50),
					new SqlParameter("@CBirthday", SqlDbType.DateTime),
					new SqlParameter("@CTelphone", SqlDbType.VarChar,20),
					new SqlParameter("@CFax", SqlDbType.VarChar,20),
					new SqlParameter("@CEmail", SqlDbType.VarChar,50),
					new SqlParameter("@CRelation", SqlDbType.VarChar,50),
					new SqlParameter("@BankFunds", SqlDbType.Float,8),
					new SqlParameter("@BankAccount", SqlDbType.VarChar,50),
					new SqlParameter("@CaseSource", SqlDbType.VarChar,100),
					new SqlParameter("@PersonalDetail", SqlDbType.Text),
					new SqlParameter("@PersonalNote", SqlDbType.Text),
					new SqlParameter("@FatherName", SqlDbType.VarChar,50),
					new SqlParameter("@FatherDOB", SqlDbType.DateTime),
					new SqlParameter("@FatherNationality", SqlDbType.VarChar,100),
					new SqlParameter("@FatherContact", SqlDbType.VarChar,500),
					new SqlParameter("@MotherName", SqlDbType.VarChar,50),
					new SqlParameter("@MotherDOB", SqlDbType.DateTime),
					new SqlParameter("@MotherNationality", SqlDbType.VarChar,100),
					new SqlParameter("@MotherContact", SqlDbType.VarChar,500),
					new SqlParameter("@SisterName", SqlDbType.VarChar,50),
					new SqlParameter("@SisterDOB", SqlDbType.DateTime),
					new SqlParameter("@SisterContact", SqlDbType.VarChar,500),
					new SqlParameter("@SisterNationality", SqlDbType.VarChar,100),
					new SqlParameter("@BrotherName", SqlDbType.VarChar,50),
					new SqlParameter("@BrotherDOB", SqlDbType.DateTime),
					new SqlParameter("@BrotherNationality", SqlDbType.VarChar,100),
					new SqlParameter("@BrotherContact", SqlDbType.VarChar,500),
					new SqlParameter("@AgreedFees", SqlDbType.Float,8),
					new SqlParameter("@FeesClusive", SqlDbType.Int,4),
					new SqlParameter("@FeesFundable", SqlDbType.Int,4),
					new SqlParameter("@PersonalStatement", SqlDbType.Text),
					new SqlParameter("@LawyerNote", SqlDbType.Text),
					new SqlParameter("@AssetAName", SqlDbType.VarChar,50),
					new SqlParameter("@AssetAWorth", SqlDbType.Float,8),
					new SqlParameter("@AssetANote", SqlDbType.VarChar,50),
					new SqlParameter("@AssetADetail", SqlDbType.VarChar,500),
					new SqlParameter("@AssetBName", SqlDbType.VarChar,50),
					new SqlParameter("@AssetBWorth", SqlDbType.Float,8),
					new SqlParameter("@AssetBNote", SqlDbType.VarChar,50),
					new SqlParameter("@AssetBDetail", SqlDbType.VarChar,500),
					new SqlParameter("@AssetCName", SqlDbType.VarChar,50),
					new SqlParameter("@AssetCWorth", SqlDbType.Float,8),
					new SqlParameter("@AssetCNote", SqlDbType.VarChar,50),
					new SqlParameter("@AssetCDetail", SqlDbType.VarChar,500),
					new SqlParameter("@UpdatedBy", SqlDbType.VarChar,36),
					new SqlParameter("@UpdatedDate", SqlDbType.DateTime)};
			parameters[0].Value = model.ArchiveID;
			parameters[1].Value = model.FullName;
			parameters[2].Value = model.Birthday;
			parameters[3].Value = model.Telphone;
			parameters[4].Value = model.Fax;
			parameters[5].Value = model.Address;
			parameters[6].Value = model.CFullName;
			parameters[7].Value = model.CBirthday;
			parameters[8].Value = model.CTelphone;
			parameters[9].Value = model.CFax;
			parameters[10].Value = model.CEmail;
			parameters[11].Value = model.CRelation;
			parameters[12].Value = model.BankFunds;
			parameters[13].Value = model.BankAccount;
			parameters[14].Value = model.CaseSource;
			parameters[15].Value = model.PersonalDetail;
			parameters[16].Value = model.PersonalNote;
			parameters[17].Value = model.FatherName;
			parameters[18].Value = model.FatherDOB;
			parameters[19].Value = model.FatherNationality;
			parameters[20].Value = model.FatherContact;
			parameters[21].Value = model.MotherName;
			parameters[22].Value = model.MotherDOB;
			parameters[23].Value = model.MotherNationality;
			parameters[24].Value = model.MotherContact;
			parameters[25].Value = model.SisterName;
			parameters[26].Value = model.SisterDOB;
			parameters[27].Value = model.SisterContact;
			parameters[28].Value = model.SisterNationality;
			parameters[29].Value = model.BrotherName;
			parameters[30].Value = model.BrotherDOB;
			parameters[31].Value = model.BrotherNationality;
			parameters[32].Value = model.BrotherContact;
			parameters[33].Value = model.AgreedFees;
			parameters[34].Value = model.FeesClusive;
			parameters[35].Value = model.FeesFundable;
			parameters[36].Value = model.PersonalStatement;
			parameters[37].Value = model.LawyerNote;
			parameters[38].Value = model.AssetAName;
			parameters[39].Value = model.AssetAWorth;
			parameters[40].Value = model.AssetANote;
			parameters[41].Value = model.AssetADetail;
			parameters[42].Value = model.AssetBName;
			parameters[43].Value = model.AssetBWorth;
			parameters[44].Value = model.AssetBNote;
			parameters[45].Value = model.AssetBDetail;
			parameters[46].Value = model.AssetCName;
			parameters[47].Value = model.AssetCWorth;
			parameters[48].Value = model.AssetCNote;
			parameters[49].Value = model.AssetCDetail;
			parameters[50].Value = model.UpdatedBy;
			parameters[51].Value = model.UpdatedDate;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(Lawyer.Model.ArchiveBaseInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update ArchiveBaseInfo set ");
			strSql.Append("FullName=@FullName,");
			strSql.Append("Birthday=@Birthday,");
			strSql.Append("Telphone=@Telphone,");
			strSql.Append("Fax=@Fax,");
			strSql.Append("Address=@Address,");
			strSql.Append("CFullName=@CFullName,");
			strSql.Append("CBirthday=@CBirthday,");
			strSql.Append("CTelphone=@CTelphone,");
			strSql.Append("CFax=@CFax,");
			strSql.Append("CEmail=@CEmail,");
			strSql.Append("CRelation=@CRelation,");
			strSql.Append("BankFunds=@BankFunds,");
			strSql.Append("BankAccount=@BankAccount,");
			strSql.Append("CaseSource=@CaseSource,");
			strSql.Append("PersonalDetail=@PersonalDetail,");
			strSql.Append("PersonalNote=@PersonalNote,");
			strSql.Append("FatherName=@FatherName,");
			strSql.Append("FatherDOB=@FatherDOB,");
			strSql.Append("FatherNationality=@FatherNationality,");
			strSql.Append("FatherContact=@FatherContact,");
			strSql.Append("MotherName=@MotherName,");
			strSql.Append("MotherDOB=@MotherDOB,");
			strSql.Append("MotherNationality=@MotherNationality,");
			strSql.Append("MotherContact=@MotherContact,");
			strSql.Append("SisterName=@SisterName,");
			strSql.Append("SisterDOB=@SisterDOB,");
			strSql.Append("SisterContact=@SisterContact,");
			strSql.Append("SisterNationality=@SisterNationality,");
			strSql.Append("BrotherName=@BrotherName,");
			strSql.Append("BrotherDOB=@BrotherDOB,");
			strSql.Append("BrotherNationality=@BrotherNationality,");
			strSql.Append("BrotherContact=@BrotherContact,");
			strSql.Append("AgreedFees=@AgreedFees,");
			strSql.Append("FeesClusive=@FeesClusive,");
			strSql.Append("FeesFundable=@FeesFundable,");
			strSql.Append("PersonalStatement=@PersonalStatement,");
			strSql.Append("LawyerNote=@LawyerNote,");
			strSql.Append("AssetAName=@AssetAName,");
			strSql.Append("AssetAWorth=@AssetAWorth,");
			strSql.Append("AssetANote=@AssetANote,");
			strSql.Append("AssetADetail=@AssetADetail,");
			strSql.Append("AssetBName=@AssetBName,");
			strSql.Append("AssetBWorth=@AssetBWorth,");
			strSql.Append("AssetBNote=@AssetBNote,");
			strSql.Append("AssetBDetail=@AssetBDetail,");
			strSql.Append("AssetCName=@AssetCName,");
			strSql.Append("AssetCWorth=@AssetCWorth,");
			strSql.Append("AssetCNote=@AssetCNote,");
			strSql.Append("AssetCDetail=@AssetCDetail,");
			strSql.Append("UpdatedBy=@UpdatedBy,");
			strSql.Append("UpdatedDate=@UpdatedDate");
			strSql.Append(" where ArchiveID=@ArchiveID ");
			SqlParameter[] parameters = {
					new SqlParameter("@FullName", SqlDbType.VarChar,50),
					new SqlParameter("@Birthday", SqlDbType.DateTime),
					new SqlParameter("@Telphone", SqlDbType.VarChar,20),
					new SqlParameter("@Fax", SqlDbType.VarChar,20),
					new SqlParameter("@Address", SqlDbType.VarChar,255),
					new SqlParameter("@CFullName", SqlDbType.VarChar,50),
					new SqlParameter("@CBirthday", SqlDbType.DateTime),
					new SqlParameter("@CTelphone", SqlDbType.VarChar,20),
					new SqlParameter("@CFax", SqlDbType.VarChar,20),
					new SqlParameter("@CEmail", SqlDbType.VarChar,50),
					new SqlParameter("@CRelation", SqlDbType.VarChar,50),
					new SqlParameter("@BankFunds", SqlDbType.Float,8),
					new SqlParameter("@BankAccount", SqlDbType.VarChar,50),
					new SqlParameter("@CaseSource", SqlDbType.VarChar,100),
					new SqlParameter("@PersonalDetail", SqlDbType.Text),
					new SqlParameter("@PersonalNote", SqlDbType.Text),
					new SqlParameter("@FatherName", SqlDbType.VarChar,50),
					new SqlParameter("@FatherDOB", SqlDbType.DateTime),
					new SqlParameter("@FatherNationality", SqlDbType.VarChar,100),
					new SqlParameter("@FatherContact", SqlDbType.VarChar,500),
					new SqlParameter("@MotherName", SqlDbType.VarChar,50),
					new SqlParameter("@MotherDOB", SqlDbType.DateTime),
					new SqlParameter("@MotherNationality", SqlDbType.VarChar,100),
					new SqlParameter("@MotherContact", SqlDbType.VarChar,500),
					new SqlParameter("@SisterName", SqlDbType.VarChar,50),
					new SqlParameter("@SisterDOB", SqlDbType.DateTime),
					new SqlParameter("@SisterContact", SqlDbType.VarChar,500),
					new SqlParameter("@SisterNationality", SqlDbType.VarChar,100),
					new SqlParameter("@BrotherName", SqlDbType.VarChar,50),
					new SqlParameter("@BrotherDOB", SqlDbType.DateTime),
					new SqlParameter("@BrotherNationality", SqlDbType.VarChar,100),
					new SqlParameter("@BrotherContact", SqlDbType.VarChar,500),
					new SqlParameter("@AgreedFees", SqlDbType.Float,8),
					new SqlParameter("@FeesClusive", SqlDbType.Int,4),
					new SqlParameter("@FeesFundable", SqlDbType.Int,4),
					new SqlParameter("@PersonalStatement", SqlDbType.Text),
					new SqlParameter("@LawyerNote", SqlDbType.Text),
					new SqlParameter("@AssetAName", SqlDbType.VarChar,50),
					new SqlParameter("@AssetAWorth", SqlDbType.Float,8),
					new SqlParameter("@AssetANote", SqlDbType.VarChar,50),
					new SqlParameter("@AssetADetail", SqlDbType.VarChar,500),
					new SqlParameter("@AssetBName", SqlDbType.VarChar,50),
					new SqlParameter("@AssetBWorth", SqlDbType.Float,8),
					new SqlParameter("@AssetBNote", SqlDbType.VarChar,50),
					new SqlParameter("@AssetBDetail", SqlDbType.VarChar,500),
					new SqlParameter("@AssetCName", SqlDbType.VarChar,50),
					new SqlParameter("@AssetCWorth", SqlDbType.Float,8),
					new SqlParameter("@AssetCNote", SqlDbType.VarChar,50),
					new SqlParameter("@AssetCDetail", SqlDbType.VarChar,500),
					new SqlParameter("@UpdatedBy", SqlDbType.VarChar,36),
					new SqlParameter("@UpdatedDate", SqlDbType.DateTime),
					new SqlParameter("@ArchiveID", SqlDbType.VarChar,36)};
			parameters[0].Value = model.FullName;
			parameters[1].Value = model.Birthday;
			parameters[2].Value = model.Telphone;
			parameters[3].Value = model.Fax;
			parameters[4].Value = model.Address;
			parameters[5].Value = model.CFullName;
			parameters[6].Value = model.CBirthday;
			parameters[7].Value = model.CTelphone;
			parameters[8].Value = model.CFax;
			parameters[9].Value = model.CEmail;
			parameters[10].Value = model.CRelation;
			parameters[11].Value = model.BankFunds;
			parameters[12].Value = model.BankAccount;
			parameters[13].Value = model.CaseSource;
			parameters[14].Value = model.PersonalDetail;
			parameters[15].Value = model.PersonalNote;
			parameters[16].Value = model.FatherName;
			parameters[17].Value = model.FatherDOB;
			parameters[18].Value = model.FatherNationality;
			parameters[19].Value = model.FatherContact;
			parameters[20].Value = model.MotherName;
			parameters[21].Value = model.MotherDOB;
			parameters[22].Value = model.MotherNationality;
			parameters[23].Value = model.MotherContact;
			parameters[24].Value = model.SisterName;
			parameters[25].Value = model.SisterDOB;
			parameters[26].Value = model.SisterContact;
			parameters[27].Value = model.SisterNationality;
			parameters[28].Value = model.BrotherName;
			parameters[29].Value = model.BrotherDOB;
			parameters[30].Value = model.BrotherNationality;
			parameters[31].Value = model.BrotherContact;
			parameters[32].Value = model.AgreedFees;
			parameters[33].Value = model.FeesClusive;
			parameters[34].Value = model.FeesFundable;
			parameters[35].Value = model.PersonalStatement;
			parameters[36].Value = model.LawyerNote;
			parameters[37].Value = model.AssetAName;
			parameters[38].Value = model.AssetAWorth;
			parameters[39].Value = model.AssetANote;
			parameters[40].Value = model.AssetADetail;
			parameters[41].Value = model.AssetBName;
			parameters[42].Value = model.AssetBWorth;
			parameters[43].Value = model.AssetBNote;
			parameters[44].Value = model.AssetBDetail;
			parameters[45].Value = model.AssetCName;
			parameters[46].Value = model.AssetCWorth;
			parameters[47].Value = model.AssetCNote;
			parameters[48].Value = model.AssetCDetail;
			parameters[49].Value = model.UpdatedBy;
			parameters[50].Value = model.UpdatedDate;
			parameters[51].Value = model.ArchiveID;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(string ArchiveID)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ArchiveBaseInfo ");
			strSql.Append(" where ArchiveID=@ArchiveID ");
			SqlParameter[] parameters = {
					new SqlParameter("@ArchiveID", SqlDbType.VarChar,36)};
			parameters[0].Value = ArchiveID;

			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		/// <summary>
		/// 批量删除数据
		/// </summary>
		public bool DeleteList(string ArchiveIDlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ArchiveBaseInfo ");
			strSql.Append(" where ArchiveID in ("+ArchiveIDlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}


		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public Lawyer.Model.ArchiveBaseInfo GetModel(string ArchiveID)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select  top 1 ArchiveID,FullName,Birthday,Telphone,Fax,Address,CFullName,CBirthday,CTelphone,CFax,CEmail,CRelation,BankFunds,BankAccount,CaseSource,PersonalDetail,PersonalNote,FatherName,FatherDOB,FatherNationality,FatherContact,MotherName,MotherDOB,MotherNationality,MotherContact,SisterName,SisterDOB,SisterContact,SisterNationality,BrotherName,BrotherDOB,BrotherNationality,BrotherContact,AgreedFees,FeesClusive,FeesFundable,PersonalStatement,LawyerNote,AssetAName,AssetAWorth,AssetANote,AssetADetail,AssetBName,AssetBWorth,AssetBNote,AssetBDetail,AssetCName,AssetCWorth,AssetCNote,AssetCDetail,UpdatedBy,UpdatedDate from ArchiveBaseInfo ");
			strSql.Append(" where ArchiveID=@ArchiveID ");
			SqlParameter[] parameters = {
					new SqlParameter("@ArchiveID", SqlDbType.VarChar,36)};
			parameters[0].Value = ArchiveID;

			Lawyer.Model.ArchiveBaseInfo model=new Lawyer.Model.ArchiveBaseInfo();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			if(ds.Tables[0].Rows.Count>0)
			{
				if(ds.Tables[0].Rows[0]["ArchiveID"]!=null && ds.Tables[0].Rows[0]["ArchiveID"].ToString()!="")
				{
					model.ArchiveID=ds.Tables[0].Rows[0]["ArchiveID"].ToString();
				}
				if(ds.Tables[0].Rows[0]["FullName"]!=null && ds.Tables[0].Rows[0]["FullName"].ToString()!="")
				{
					model.FullName=ds.Tables[0].Rows[0]["FullName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["Birthday"]!=null && ds.Tables[0].Rows[0]["Birthday"].ToString()!="")
				{
					model.Birthday=DateTime.Parse(ds.Tables[0].Rows[0]["Birthday"].ToString());
				}
				if(ds.Tables[0].Rows[0]["Telphone"]!=null && ds.Tables[0].Rows[0]["Telphone"].ToString()!="")
				{
					model.Telphone=ds.Tables[0].Rows[0]["Telphone"].ToString();
				}
				if(ds.Tables[0].Rows[0]["Fax"]!=null && ds.Tables[0].Rows[0]["Fax"].ToString()!="")
				{
					model.Fax=ds.Tables[0].Rows[0]["Fax"].ToString();
				}
				if(ds.Tables[0].Rows[0]["Address"]!=null && ds.Tables[0].Rows[0]["Address"].ToString()!="")
				{
					model.Address=ds.Tables[0].Rows[0]["Address"].ToString();
				}
				if(ds.Tables[0].Rows[0]["CFullName"]!=null && ds.Tables[0].Rows[0]["CFullName"].ToString()!="")
				{
					model.CFullName=ds.Tables[0].Rows[0]["CFullName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["CBirthday"]!=null && ds.Tables[0].Rows[0]["CBirthday"].ToString()!="")
				{
					model.CBirthday=DateTime.Parse(ds.Tables[0].Rows[0]["CBirthday"].ToString());
				}
				if(ds.Tables[0].Rows[0]["CTelphone"]!=null && ds.Tables[0].Rows[0]["CTelphone"].ToString()!="")
				{
					model.CTelphone=ds.Tables[0].Rows[0]["CTelphone"].ToString();
				}
				if(ds.Tables[0].Rows[0]["CFax"]!=null && ds.Tables[0].Rows[0]["CFax"].ToString()!="")
				{
					model.CFax=ds.Tables[0].Rows[0]["CFax"].ToString();
				}
				if(ds.Tables[0].Rows[0]["CEmail"]!=null && ds.Tables[0].Rows[0]["CEmail"].ToString()!="")
				{
					model.CEmail=ds.Tables[0].Rows[0]["CEmail"].ToString();
				}
				if(ds.Tables[0].Rows[0]["CRelation"]!=null && ds.Tables[0].Rows[0]["CRelation"].ToString()!="")
				{
					model.CRelation=ds.Tables[0].Rows[0]["CRelation"].ToString();
				}
				if(ds.Tables[0].Rows[0]["BankFunds"]!=null && ds.Tables[0].Rows[0]["BankFunds"].ToString()!="")
				{
					model.BankFunds=decimal.Parse(ds.Tables[0].Rows[0]["BankFunds"].ToString());
				}
				if(ds.Tables[0].Rows[0]["BankAccount"]!=null && ds.Tables[0].Rows[0]["BankAccount"].ToString()!="")
				{
					model.BankAccount=ds.Tables[0].Rows[0]["BankAccount"].ToString();
				}
				if(ds.Tables[0].Rows[0]["CaseSource"]!=null && ds.Tables[0].Rows[0]["CaseSource"].ToString()!="")
				{
					model.CaseSource=ds.Tables[0].Rows[0]["CaseSource"].ToString();
				}
				if(ds.Tables[0].Rows[0]["PersonalDetail"]!=null && ds.Tables[0].Rows[0]["PersonalDetail"].ToString()!="")
				{
					model.PersonalDetail=ds.Tables[0].Rows[0]["PersonalDetail"].ToString();
				}
				if(ds.Tables[0].Rows[0]["PersonalNote"]!=null && ds.Tables[0].Rows[0]["PersonalNote"].ToString()!="")
				{
					model.PersonalNote=ds.Tables[0].Rows[0]["PersonalNote"].ToString();
				}
				if(ds.Tables[0].Rows[0]["FatherName"]!=null && ds.Tables[0].Rows[0]["FatherName"].ToString()!="")
				{
					model.FatherName=ds.Tables[0].Rows[0]["FatherName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["FatherDOB"]!=null && ds.Tables[0].Rows[0]["FatherDOB"].ToString()!="")
				{
					model.FatherDOB=DateTime.Parse(ds.Tables[0].Rows[0]["FatherDOB"].ToString());
				}
				if(ds.Tables[0].Rows[0]["FatherNationality"]!=null && ds.Tables[0].Rows[0]["FatherNationality"].ToString()!="")
				{
					model.FatherNationality=ds.Tables[0].Rows[0]["FatherNationality"].ToString();
				}
				if(ds.Tables[0].Rows[0]["FatherContact"]!=null && ds.Tables[0].Rows[0]["FatherContact"].ToString()!="")
				{
					model.FatherContact=ds.Tables[0].Rows[0]["FatherContact"].ToString();
				}
				if(ds.Tables[0].Rows[0]["MotherName"]!=null && ds.Tables[0].Rows[0]["MotherName"].ToString()!="")
				{
					model.MotherName=ds.Tables[0].Rows[0]["MotherName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["MotherDOB"]!=null && ds.Tables[0].Rows[0]["MotherDOB"].ToString()!="")
				{
					model.MotherDOB=DateTime.Parse(ds.Tables[0].Rows[0]["MotherDOB"].ToString());
				}
				if(ds.Tables[0].Rows[0]["MotherNationality"]!=null && ds.Tables[0].Rows[0]["MotherNationality"].ToString()!="")
				{
					model.MotherNationality=ds.Tables[0].Rows[0]["MotherNationality"].ToString();
				}
				if(ds.Tables[0].Rows[0]["MotherContact"]!=null && ds.Tables[0].Rows[0]["MotherContact"].ToString()!="")
				{
					model.MotherContact=ds.Tables[0].Rows[0]["MotherContact"].ToString();
				}
				if(ds.Tables[0].Rows[0]["SisterName"]!=null && ds.Tables[0].Rows[0]["SisterName"].ToString()!="")
				{
					model.SisterName=ds.Tables[0].Rows[0]["SisterName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["SisterDOB"]!=null && ds.Tables[0].Rows[0]["SisterDOB"].ToString()!="")
				{
					model.SisterDOB=DateTime.Parse(ds.Tables[0].Rows[0]["SisterDOB"].ToString());
				}
				if(ds.Tables[0].Rows[0]["SisterContact"]!=null && ds.Tables[0].Rows[0]["SisterContact"].ToString()!="")
				{
					model.SisterContact=ds.Tables[0].Rows[0]["SisterContact"].ToString();
				}
				if(ds.Tables[0].Rows[0]["SisterNationality"]!=null && ds.Tables[0].Rows[0]["SisterNationality"].ToString()!="")
				{
					model.SisterNationality=ds.Tables[0].Rows[0]["SisterNationality"].ToString();
				}
				if(ds.Tables[0].Rows[0]["BrotherName"]!=null && ds.Tables[0].Rows[0]["BrotherName"].ToString()!="")
				{
					model.BrotherName=ds.Tables[0].Rows[0]["BrotherName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["BrotherDOB"]!=null && ds.Tables[0].Rows[0]["BrotherDOB"].ToString()!="")
				{
					model.BrotherDOB=DateTime.Parse(ds.Tables[0].Rows[0]["BrotherDOB"].ToString());
				}
				if(ds.Tables[0].Rows[0]["BrotherNationality"]!=null && ds.Tables[0].Rows[0]["BrotherNationality"].ToString()!="")
				{
					model.BrotherNationality=ds.Tables[0].Rows[0]["BrotherNationality"].ToString();
				}
				if(ds.Tables[0].Rows[0]["BrotherContact"]!=null && ds.Tables[0].Rows[0]["BrotherContact"].ToString()!="")
				{
					model.BrotherContact=ds.Tables[0].Rows[0]["BrotherContact"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AgreedFees"]!=null && ds.Tables[0].Rows[0]["AgreedFees"].ToString()!="")
				{
					model.AgreedFees=decimal.Parse(ds.Tables[0].Rows[0]["AgreedFees"].ToString());
				}
				if(ds.Tables[0].Rows[0]["FeesClusive"]!=null && ds.Tables[0].Rows[0]["FeesClusive"].ToString()!="")
				{
					model.FeesClusive=int.Parse(ds.Tables[0].Rows[0]["FeesClusive"].ToString());
				}
				if(ds.Tables[0].Rows[0]["FeesFundable"]!=null && ds.Tables[0].Rows[0]["FeesFundable"].ToString()!="")
				{
					model.FeesFundable=int.Parse(ds.Tables[0].Rows[0]["FeesFundable"].ToString());
				}
				if(ds.Tables[0].Rows[0]["PersonalStatement"]!=null && ds.Tables[0].Rows[0]["PersonalStatement"].ToString()!="")
				{
					model.PersonalStatement=ds.Tables[0].Rows[0]["PersonalStatement"].ToString();
				}
				if(ds.Tables[0].Rows[0]["LawyerNote"]!=null && ds.Tables[0].Rows[0]["LawyerNote"].ToString()!="")
				{
					model.LawyerNote=ds.Tables[0].Rows[0]["LawyerNote"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetAName"]!=null && ds.Tables[0].Rows[0]["AssetAName"].ToString()!="")
				{
					model.AssetAName=ds.Tables[0].Rows[0]["AssetAName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetAWorth"]!=null && ds.Tables[0].Rows[0]["AssetAWorth"].ToString()!="")
				{
					model.AssetAWorth=decimal.Parse(ds.Tables[0].Rows[0]["AssetAWorth"].ToString());
				}
				if(ds.Tables[0].Rows[0]["AssetANote"]!=null && ds.Tables[0].Rows[0]["AssetANote"].ToString()!="")
				{
					model.AssetANote=ds.Tables[0].Rows[0]["AssetANote"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetADetail"]!=null && ds.Tables[0].Rows[0]["AssetADetail"].ToString()!="")
				{
					model.AssetADetail=ds.Tables[0].Rows[0]["AssetADetail"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetBName"]!=null && ds.Tables[0].Rows[0]["AssetBName"].ToString()!="")
				{
					model.AssetBName=ds.Tables[0].Rows[0]["AssetBName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetBWorth"]!=null && ds.Tables[0].Rows[0]["AssetBWorth"].ToString()!="")
				{
					model.AssetBWorth=decimal.Parse(ds.Tables[0].Rows[0]["AssetBWorth"].ToString());
				}
				if(ds.Tables[0].Rows[0]["AssetBNote"]!=null && ds.Tables[0].Rows[0]["AssetBNote"].ToString()!="")
				{
					model.AssetBNote=ds.Tables[0].Rows[0]["AssetBNote"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetBDetail"]!=null && ds.Tables[0].Rows[0]["AssetBDetail"].ToString()!="")
				{
					model.AssetBDetail=ds.Tables[0].Rows[0]["AssetBDetail"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetCName"]!=null && ds.Tables[0].Rows[0]["AssetCName"].ToString()!="")
				{
					model.AssetCName=ds.Tables[0].Rows[0]["AssetCName"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetCWorth"]!=null && ds.Tables[0].Rows[0]["AssetCWorth"].ToString()!="")
				{
					model.AssetCWorth=decimal.Parse(ds.Tables[0].Rows[0]["AssetCWorth"].ToString());
				}
				if(ds.Tables[0].Rows[0]["AssetCNote"]!=null && ds.Tables[0].Rows[0]["AssetCNote"].ToString()!="")
				{
					model.AssetCNote=ds.Tables[0].Rows[0]["AssetCNote"].ToString();
				}
				if(ds.Tables[0].Rows[0]["AssetCDetail"]!=null && ds.Tables[0].Rows[0]["AssetCDetail"].ToString()!="")
				{
					model.AssetCDetail=ds.Tables[0].Rows[0]["AssetCDetail"].ToString();
				}
				if(ds.Tables[0].Rows[0]["UpdatedBy"]!=null && ds.Tables[0].Rows[0]["UpdatedBy"].ToString()!="")
				{
					model.UpdatedBy=ds.Tables[0].Rows[0]["UpdatedBy"].ToString();
				}
				if(ds.Tables[0].Rows[0]["UpdatedDate"]!=null && ds.Tables[0].Rows[0]["UpdatedDate"].ToString()!="")
				{
					model.UpdatedDate=DateTime.Parse(ds.Tables[0].Rows[0]["UpdatedDate"].ToString());
				}
				return model;
			}
			else
			{
				return null;
			}
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ArchiveID,FullName,Birthday,Telphone,Fax,Address,CFullName,CBirthday,CTelphone,CFax,CEmail,CRelation,BankFunds,BankAccount,CaseSource,PersonalDetail,PersonalNote,FatherName,FatherDOB,FatherNationality,FatherContact,MotherName,MotherDOB,MotherNationality,MotherContact,SisterName,SisterDOB,SisterContact,SisterNationality,BrotherName,BrotherDOB,BrotherNationality,BrotherContact,AgreedFees,FeesClusive,FeesFundable,PersonalStatement,LawyerNote,AssetAName,AssetAWorth,AssetANote,AssetADetail,AssetBName,AssetBWorth,AssetBNote,AssetBDetail,AssetCName,AssetCWorth,AssetCNote,AssetCDetail,UpdatedBy,UpdatedDate ");
			strSql.Append(" FROM ArchiveBaseInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}

		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" ArchiveID,FullName,Birthday,Telphone,Fax,Address,CFullName,CBirthday,CTelphone,CFax,CEmail,CRelation,BankFunds,BankAccount,CaseSource,PersonalDetail,PersonalNote,FatherName,FatherDOB,FatherNationality,FatherContact,MotherName,MotherDOB,MotherNationality,MotherContact,SisterName,SisterDOB,SisterContact,SisterNationality,BrotherName,BrotherDOB,BrotherNationality,BrotherContact,AgreedFees,FeesClusive,FeesFundable,PersonalStatement,LawyerNote,AssetAName,AssetAWorth,AssetANote,AssetADetail,AssetBName,AssetBWorth,AssetBNote,AssetBDetail,AssetCName,AssetCWorth,AssetCNote,AssetCDetail,UpdatedBy,UpdatedDate ");
			strSql.Append(" FROM ArchiveBaseInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}

		/*
		/// <summary>
		/// 分页获取数据列表
		/// </summary>
		public DataSet GetList(int PageSize,int PageIndex,string strWhere)
		{
			SqlParameter[] parameters = {
					new SqlParameter("@tblName", SqlDbType.VarChar, 255),
					new SqlParameter("@fldName", SqlDbType.VarChar, 255),
					new SqlParameter("@PageSize", SqlDbType.Int),
					new SqlParameter("@PageIndex", SqlDbType.Int),
					new SqlParameter("@IsReCount", SqlDbType.Bit),
					new SqlParameter("@OrderType", SqlDbType.Bit),
					new SqlParameter("@strWhere", SqlDbType.VarChar,1000),
					};
			parameters[0].Value = "ArchiveBaseInfo";
			parameters[1].Value = "ArchiveID";
			parameters[2].Value = PageSize;
			parameters[3].Value = PageIndex;
			parameters[4].Value = 0;
			parameters[5].Value = 0;
			parameters[6].Value = strWhere;	
			return DbHelperSQL.RunProcedure("UP_GetRecordByPage",parameters,"ds");
		}*/

		#endregion  Method
	}
}

